1.conf文件

server {
    listen       80;
    server_name  mmy.109.com;
    root   /data/www/mmy.nginx.com;

    #access_log  logs/host.access.log  main;

    # 配置域名重定向
    #if ($host != 'www.jt018.com' ) {
    #    rewrite ^/(.*)$ http://www.yphp.cn/$1 permanent;
    #}

    location / {

        # 配置rewrite
        if (!-e $request_filename) {
            rewrite  ^(.*)$  /index.php?$1  last;
            break;
        }

        # include  /usr/local/nginx/html/yphp/.htaccess;
        # rewrite ^/(.+)/(.+)[/]?$ /index.php?m=$1&a=$2 last;

        # 配置默认访问文件
        index default.php index.html index.php index.htm;
    }


    error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    #location = /50x.html {
    #    root   html;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_intercept_errors on;
        # fastcgi_pass   phpServer;    # 修改为upstream定义的名称
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

}

2.nginx.conf

user www www;
worker_processes auto;

error_log /data/logs/error_nginx.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;

events {
    use epoll;
    worker_connections 51200;
    multi_accept on;
    }

http {
    include mime.types;
    default_type application/octet-stream;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 1024m;
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 120;
    server_tokens off;
    tcp_nodelay on;

    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;

    #Gzip Compression
    gzip on;
    gzip_buffers 16 8k;
    gzip_comp_level 6;
    gzip_http_version 1.1;
    gzip_min_length 256;
    gzip_proxied any;
    gzip_vary on;
    gzip_types
        text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
        text/javascript application/javascript application/x-javascript
        text/x-json application/json application/x-web-app-manifest+json
        text/css text/plain text/x-component
        font/opentype application/x-font-ttf application/vnd.ms-fontobject
        image/x-icon;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

######################## default ############################
# server{
#    listen 80;
#    server_name mmy.109.com;
#    index index.html index.htm index.php;
#    root /data/www/mmy.nginx.com;
#
#    location ~ \.php$ {
#        include fastcgi_params;
#        fastcgi_pass 127.0.0.1:9000;
#        fastcgi_index index.php;
#        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#    }
#
#}
########################## vhost #############################
include vhost/*.conf;
}

3.linux查找文件夹或者文件命令

例如:
find / -name nginx.conf
find /-name mysql

mmy123456
376 声望17 粉丝

有项目请联系:15201970281(毛毛)